
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN"
  "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
<html xmlns:th="www.thymeleaf.org"
		xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh-hans"
	version="XHTML+RDFa 1.0" dir="ltr">

<head profile="http://www.w3.org/1999/xhtml/vocab">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="shortcut icon" href="misc/favicon.ico"
	type="image/vnd.microsoft.icon" />
<meta name="generator" content="开放书屋 (#)" />
<meta name="rights" content="开放书屋，版权所有" />
<title>购物车 | 灿然书屋</title>
<link type="text/css" rel="stylesheet"
	href="sites/default/files/css/css_xE-rWrJf-fncB6ztZfd2huxqgxu4WO-qwma6Xer30m4.css"
	media="all" />
<link type="text/css" rel="stylesheet"
	href="sites/default/files/css/css_rAWFMaRvev_YVJgRAKK7yVXwsgx9afi98jo7qDGwEf8.css"
	media="all" />
<link type="text/css" rel="stylesheet"
	href="sites/default/files/css/css_yuuoo38Er7VI_9K11joqfSw2F9DZWvjiyidQE8X2W-4.css"
	media="all" />
<link type="text/css" rel="stylesheet"
	href="sites/default/files/css/css_bdATSoh3o2IK3XRLY7797zuX1tE3-0Stkdq5mD0eflg.css"
	media="all" />

<!--[if lt IE 9]>
<link type="text/css" rel="stylesheet" href="sites/all/themes/dushu/css/fix-ie7.css?q633bi" media="all" />
<![endif]-->

<!--[if lt IE 7]>
<link type="text/css" rel="stylesheet" href="sites/all/themes/dushu/css/fix-ie6.css?q633bi" media="all" />
<![endif]-->
<script type="text/javascript"
	src="sites/default/files/js/js_qikmINIYTWe4jcTUn8cKiMr8bmSDiZB9LQqvceZ6wlM.js"></script>
<script type="text/javascript"
	src="sites/default/files/js/js_6uMVSUgDf9ldb_NCxvCamFQoenOq-XcovWYUCJT4HIU.js"></script>
<script type="text/javascript"
	src="sites/default/files/js/js_cgduOnDY33XCpIGYUlxEgk68DoYxEdyU12ZwHN3ioKo.js"></script>
<script type="text/javascript"
	src="sites/default/files/js/js_xThLSve1PKygorKK3W5JBKVAg5PaB1uw7YAS7kRSzqc.js"></script>
<script type="text/javascript">
<!--//--><![CDATA[//><!--
	jQuery
			.extend(
					Drupal.settings,
					{
						"basePath" : "\/",
						"pathPrefix" : "",
						"ajaxPageState" : {
							"theme" : "dushu",
							"theme_token" : "2wzzumDZJcplLA5Ou-eftx3XEUlBBNGm_rx3SkVa94M",
							"js" : {
								"0" : 1,
								"1" : 1,
								"misc\/jquery.js" : 1,
								"misc\/jquery-extend-3.4.0.js" : 1,
								"misc\/jquery.once.js" : 1,
								"misc\/drupal.js" : 1,
								"sites\/all\/modules\/lazyloader\/jquery.lazyloader.js" : 1,
								"sites\/all\/libraries\/ueditor\/third-party\/SyntaxHighlighter\/shCore.js" : 1,
								"public:\/\/languages\/zh-hans_MGNxAABCo8FuXfHAWwvv78Fy5rUBtQGbntYeDIrMceY.js" : 1,
								"misc\/tableheader.js" : 1,
								"sites\/all\/themes\/dushu\/js\/script.js" : 1
							},
							"css" : {
								"modules\/system\/system.base.css" : 1,
								"modules\/system\/system.menus.css" : 1,
								"modules\/system\/system.messages.css" : 1,
								"modules\/system\/system.theme.css" : 1,
								"modules\/comment\/comment.css" : 1,
								"sites\/all\/modules\/date\/date_api\/date.css" : 1,
								"sites\/all\/modules\/date\/date_popup\/themes\/datepicker.1.7.css" : 1,
								"modules\/field\/theme\/field.css" : 1,
								"modules\/node\/node.css" : 1,
								"modules\/search\/search.css" : 1,
								"sites\/all\/modules\/ubercart\/uc_order\/uc_order.css" : 1,
								"sites\/all\/modules\/ubercart\/uc_product\/uc_product.css" : 1,
								"sites\/all\/modules\/ubercart\/uc_store\/uc_store.css" : 1,
								"modules\/user\/user.css" : 1,
								"sites\/all\/modules\/views\/css\/views.css" : 1,
								"sites\/all\/modules\/lazyloader\/lazyloader.css" : 1,
								"sites\/all\/modules\/ctools\/css\/ctools.css" : 1,
								"sites\/all\/modules\/panels\/css\/panels.css" : 1,
								"sites\/all\/libraries\/ueditor\/third-party\/SyntaxHighlighter\/shCoreDefault.css" : 1,
								"sites\/all\/modules\/ubercart\/uc_cart\/uc_cart.css" : 1,
								"sites\/all\/themes\/dushu\/css\/style.css" : 1,
								"sites\/all\/themes\/dushu\/css\/custom.css" : 1,
								"sites\/all\/themes\/dushu\/css\/custom1.css" : 1,
								"sites\/all\/themes\/dushu\/css\/custom2.css" : 1,
								"sites\/all\/themes\/dushu\/css\/custom3.css" : 1,
								"sites\/all\/themes\/dushu\/css\/fix-ie7.css" : 1,
								"sites\/all\/themes\/dushu\/css\/fix-ie6.css" : 1
							}
						},
						"jcarousel" : {
							"ajaxPath" : "\/jcarousel\/ajax\/views"
						},
						"urlIsAjaxTrusted" : {
							"\/cart" : true
						}
					});
	//--><!]]>
</script>
<!--[if lt IE 7]>
      <style type="text/css" media="all">@import url("//sites/all/themes/dushu/css/fix-ie6.css");</style>
  <![endif]-->
<!--[if IE 7]>
   <style type="text/css" media="all">@import url("//sites/all/themes/dushu/css/fix-ie7.css");</style>
  <![endif]-->
</head>
<body class="html not-front not-logged-in no-sidebars page-cart">
	<div id="skip-link">
		<a href="#main-content" class="element-invisible element-focusable">跳转到主要内容</a>
	</div>


	<!--首页头部-->

	<div th:replace="index::div#mininav"></div>

	<div th:replace="index::div#header-wrapper1"></div>

	<div th:replace="index::div.head_nav"></div>

	<div class="class_nav"></div>
	<div class="breadcrumb" id="breadcrumb">
		<h2 class="element-invisible">你在这里</h2>
		<div class="breadcrumb">
			<a href="/">首页</a>
		</div>
	</div>
	<div id="cartv">
	<div id="content">
		<a id="main-content"></a>
		<h1 class="title" id="page-title">购物车</h1>
		<div class="tabs"></div>
		<div class="region region-content">
			<div id="block-system-main" class="block block-system">


				<div class="content">
					<div id="cart-form-pane">

							<div>
								<table class="sticky-enabled" >
									<thead>
										<tr>
											<th>移除</th>
											<th>图片</th>
											<th>名称</th>
											<th>数量</th>
											<th style="text-align: right">总计</th>
										</tr>
									</thead>
									<tbody>
										<tr class="odd" v-for="b in books">
											<td class="remove">
												<input @click="decart(b.id)" type="submit" id="edit-items-0-remove" n
													   ame="remove-0" value="移除"
												class="form-submit" />
											</td>
											<td class="image">
												<a href="book.htm">
													<img :src="b.pic"
													width="50" height="50" alt="" />
												</a>
											</td>
											<td class="desc">
												<a href="#">{{b.name}}</a>
											</td>
											<td class="qty">
												<div class="form-item form-type-uc-quantity form-item-items-0-qty">
													<label class="element-invisible" for="edit-items-0-qty">数量
														<span class="form-required" title="此项必填。">*</span>
													</label>
													<div>{{b.cnt}}</div>
												</div>
											</td>
											<td class="price">
												<span  class="uc-price">{{b.price * 0.8 * b.cnt | numFilter}}</span>
											</td>
										</tr>

										<tr class="odd">
											<td colspan="5" class="subtotal">
												<span id="subtotal-title">小计：</span>
												<span class="uc-price" >¥{{totalP}}</span>

											</td>
										</tr>

									</tbody>
								</table>
								<div
									class="entity entity-uc-cart-item uc-cart-item-uc-cart-item clearfix">


									<div class="content">
										<input type="hidden" name="items[0][data]"
											value="a:3:{s:9:&quot;shippable&quot;;s:1:&quot;1&quot;;s:4:&quot;type&quot;;s:4:&quot;book&quot;;s:6:&quot;module&quot;;s:10:&quot;uc_product&quot;;}" />
										<input type="hidden" name="items[0][cart_item_id]"
											value="1857044" />
									</div>
								</div>
								<div
									class="entity entity-uc-cart-item uc-cart-item-uc-cart-item clearfix">


									<div class="content">
										<input type="hidden" name="items[1][data]"
											value="a:3:{s:9:&quot;shippable&quot;;s:1:&quot;1&quot;;s:4:&quot;type&quot;;s:4:&quot;book&quot;;s:6:&quot;module&quot;;s:10:&quot;uc_product&quot;;}" />
										<input type="hidden" name="items[1][cart_item_id]"
											value="1857046" />
									</div>
								</div>
								<input type="hidden" name="form_build_id"
									value="form-qUTzAUWnrPw06ImHXo7-FGHMyrfGAqca1EcaxRmlWzk" />
								<input type="hidden" name="form_id" value="uc_cart_view_form" />
								<div class="form-actions form-wrapper" id="edit-actions" style="text-align: right">
									<a href="index.htm">继续购物</a>
									<input type="submit" id="edit-update" name="update-cart" value="更新购物车" class="form-submit"  />
									<input @click.prevent="addOrder" type="submit" id="edit-checkout--2" name="op" value="结算" class="form-submit" />

								</div>
							</div>
						</form>
					</div>
				</div>
			</div>
		</div>
	</div>
	</div>
	<script>
		var cv = new Vue({
			el:"#cartv",
			data:{
				books:[],
				totalP: 1,
				user:{}
			},
			created(){
				axios.get("xm-user/xm/crUser/getCarts").then(res=>{
					this.books = res.data.data;

				})
				axios.get("xm-user/getLoginedUser").then(res=>{
					if (res.data.code){
						this.user = res.data.data;
					}
				});
				this.computed.sum();

			},
			methods:{
				addOrder(){
					axios.get("xm-user/xm/crBought/addOrder",{
						params:{
							id:this.user.id
						}
					}).then(res=>{
						if (res.data.code){
							alert("添加订单成功！")
							location.href="/";
						}
					})
				},
				decart(bookid){
					axios.get("xm-user/xm/crUser/deCart",{
						params:{
							bid:bookid
						}
					}).then(res=>{
						alert("该商品删除成功！");
						location.href="cart.htm"
					})
				}
			},
			// computed: {
			// 	sum() {
			// 		for( v in this.books) {
			// 			this.totalP += this.books[v].price * this.books[v].price.cnt;
			// 		}
			//
			// 	},
			// },
			filters: {
				numFilter (value) {
					// 截取当前数据到小数点后两位
					let realVal = parseFloat(value).toFixed(2)
					return realVal
				}
			}

		})
	</script>




	<div class="clear"></div>



	<div th:replace="index::div#footer"></div>
	<a class="go_top" href="javascript:void(0);"></a>




	<div class="region region-page-bottom">
		<noscript>
			<style type="text/css" media="all">
img[data-src] {
	display: none !important;
}
</style>
		</noscript>
	</div>
	<script type="text/javascript">
	<!--//--><![CDATA[//><!--
		(function($) {
			Drupal.behaviors.lazyloader = {
				attach : function(context, settings) {
					$("img[data-src]")
							.lazyloader(
									{
										distance : 0,
										icon : "sites/all/modules/lazyloader/loader/loader-7.gif"
									});
				}
			};
		}(jQuery));
		//--><!]]>
	</script>
	<script type="text/javascript">
	<!--//--><![CDATA[//><!--
		SyntaxHighlighter.all();
		//--><!]]>
	</script>
</body>
</html>
